from typing import Dict, List

from faker import Faker

from modules.datafaker.strategies.base_strategy import BaseStrategy
from modules.datafaker.strategies.specific_strategy import strategy_map

fakeEngine = Faker("zh_CN")

DictList = List[Dict[str, str]]


def create_strategy_list():
    strategy_list: DictList = []
    for key in strategy_map:
        strategy: BaseStrategy = strategy_map[key]
        strategy_list.append({
            'title': strategy.title,
            'name:': strategy.name,
        })

    return strategy_list


def execute_strategy(strategy_name: str) -> object:
    instance: BaseStrategy = strategy_map.get(strategy_name)

    if instance is None:
        return None

    return instance.fake_data(fakeEngine, {})
